package com.zhsource.article.service.impl;

import com.zhsource.article.document.Comment;
import com.zhsource.article.repository.CommentRepository;
import com.zhsource.article.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>@ClassName：CommentServiceImpl
 * <p>@Date 2023/10/29  21:27
 *
 * @Author zzl
 **/
@Service
public class CommentServiceImpl implements ICommentService {

    @Autowired
    private CommentRepository commentRepository;


    @Override
    public List<Comment> findByArticleId(Long articleId) {
        return commentRepository.findByArticleId(articleId);
    }


    @Override
    public void insert(Comment comment) {
        commentRepository.save(comment);
    }

    @Override
    public void delete(String id) {
        commentRepository.deleteById(id);

    }
}
